package com.msmall.community.common.model;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.msmall.base.model.BaseObject;
import com.msmall.base.util.Constants;
import com.msmall.community.common.util.LinkUtil;


@Entity
@Table(name="base_link")
public class Link extends BaseObject {
	
	private static final long serialVersionUID = 7911647466445932995L;

	@Id
	@Column(name="link_id")
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private Long linkid;

	//1:文字  2 图片 ConstantDB.Link_type_
	@Column(name="types")
	private Short types;

	@Column(name="name")
	private String name;

	@Column(name="link_url")
	private String linkUrl;
	
	@Column(name="image_path")
	private String imagePath;
	
	@Column(name="image_name")
	private String imageName;

	/**
	 * 1为最高序
	 */
	@Column(name="orders")
	private Integer orders;

	@Column(name="description")
	private String description;

	@Column(name="enabled")
	private Short enabled;
	
	@Column(name="create_time")
	@Temporal(TemporalType.TIMESTAMP)
	private Date createTime;

	public Link() {
		super();
	}

	public Long getLinkid() {
		return linkid;
	}

	public void setLinkid(Long linkid) {
		this.linkid = linkid;
	}

	public Short getTypes() {
		return types;
	}

	public void setTypes(Short types) {
		this.types = types;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getLinkUrl() {
		return linkUrl;
	}

	public void setLinkUrl(String linkUrl) {
		this.linkUrl = linkUrl;
	}

	public String getImagePath() {
		return imagePath;
	}

	public void setImagePath(String imagePath) {
		this.imagePath = imagePath;
	}

	public String getImageName() {
		return imageName;
	}

	public void setImageName(String imageName) {
		this.imageName = imageName;
	}

	public Integer getOrders() {
		return orders;
	}

	public void setOrders(Integer orders) {
		this.orders = orders;
	}

	public Short getEnabled() {
		return enabled;
	}

	public void setEnabled(Short enabled) {
		this.enabled = enabled;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public String getHtmlImage(){
		return LinkUtil.getHomePath(linkid, Constants.USER_AGENT_TYPE_HTML) + imageName;
	}
	
	public String getWmlImage(){
		return LinkUtil.getHomePath(linkid, Constants.USER_AGENT_TYPE_WML) + imageName;
	}
	
	@Override
	public boolean equals(Object o) {
		return false;
	}

	@Override
	public int hashCode() {
		return 0;
	}

	@Override
	public String toString() {
		return null;
	}

}
